test(ci): add unit-test seam for lint-composite-actions.mjs#7494
Conversation
findActionFiles, the JSON-schema validation, and the composite-only shell:-presence check only ran inside the disk-reading / process.exit driver, so none was testable in isolation. Extract compileActionSchema, findActionFiles (readdir/readFile injected), validateActionFile (pure: takes path + YAML text + a compiled validator), and a runLint driver returning an exit code; gate the schema/actions-tree disk reads behind import.meta.url === argv[1]. Add scripts/lint-composite-actions.d.mts and test/unit/lint-composite-actions-script.test.ts covering: a run: step missing shell: is flagged with its exact index/name; a schema violation is flagged; a well-formed composite action passes; a subdir with no action.yml/.yaml is silently skipped; and the no-files early-exit. Validates against the real vendored schema. Direct-invocation behavior is unchanged. Closes JSONbored#7459
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7494 +/- ##
=======================================
Coverage 91.41% 91.41%
=======================================
Files 717 717
Lines 73035 73035
Branches 21635 21635
=======================================
Hits 66765 66765
Misses 5227 5227
Partials 1043 1043
Flags with carried forward coverage won't be shown. Click here to find out more. |
|
Caution 🛑 LoopOver review result - fixes requiredReview updated: 2026-07-20 13:17:49 UTC
Review summary Nits — 1 non-blocking
CI checks failing
Decision drivers
Context & advisory signals — never blocks the verdict
Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
|
LoopOver is closing this pull request on the maintainer's behalf (CI is failing (validate, validate-code)). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed. |
Closes #7459
What
lint-composite-actions.mjs'sfindActionFiles, JSON-schema validation, and the composite-only "everyrun:step needs an explicitshell:" check only ran inside the disk-reading /process.exitdriver — none was testable in isolation.compileActionSchema,findActionFiles(withreaddir/readFileinjected),validateActionFile(pure: path + YAML text + a compiled validator → error lines), and arunLintdriver returning the exit code.import.meta.url === pathToFileURL(process.argv[1]).href. Direct invocation is unchanged.scripts/lint-composite-actions.d.mtsandtest/unit/lint-composite-actions-script.test.ts.Tests (green locally under
vitest run test/unit, against the real vendored schema)run:step missingshell:is flagged with its exactruns.steps[i] ("name").runsblock) is flagged.run:steps all carry ashell:passes cleanly.action.ymlnoraction.yamlis silently skipped.Verified: importing makes no disk/network access; the typed
.mjsimport resolves via the.d.mts(noTS7016).scripts/**isn't incoverage.include.